import time, threading
import wx

class RecordTimer(threading.Thread):
    def __init__(self, window):
        threading.Thread.__init__(self)
        self.timer = 1
        self.window = window
        self.s = 0
        self.m = 0
        self.h = 0
    def run(self):
        while (self.timer == 1):
            time.sleep(1)
            self.s += 1
            if self.s == 60:
                self.s = 0
                self.m += 1
                if self.m == 60:
                    self.m = 0
                    self.h += 1
#            print "%d:%d:%d"%(self.h, self.m, self.s)
            wx.CallAfter(self.window.SetTimer,"%d:%d:%d"%(self.h, self.m, self.s))

    def stop(self):
        self.timer = 0